package com.annhoa.oauth2fegin.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;

public class BPwdEncoderUtil {
  private static final PasswordEncoder ENCODER = PasswordEncoderFactories.createDelegatingPasswordEncoder();
  private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();

  public static String BCryptPassword(String password){
    return encoder.encode(password);
  }
  public static boolean matches (CharSequence rawPassword, String encodedPassword) {
    return encoder.matches(rawPassword, encodedPassword);
  }
//  public static String encode(String password) {
//    return ENCODER.encode(password);
//  }
//  public static boolean matches(CharSequence rawPassword, String encodedPassword) {
//    return ENCODER.matches(rawPassword, encodedPassword);
//  }
}
